﻿<Window x:Class="XSemmel.SampleGenerator.Xsd2XmlGenerator"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:AvalonEdit="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit" 
             xmlns:fluent="clr-namespace:Fluent;assembly=Fluent"
             fluent:RibbonProperties.TitleBarHeight="0"
             mc:Ignorable="d" 
             d:DesignHeight="250" d:DesignWidth="750"
             MinHeight="250" MinWidth="400"
             Icon="/Images/Generate_XML_32x32.png" 
        Title="Xsd2Xml sample generator">
    <DockPanel>
        <fluent:Ribbon x:Name="Ribbon" DockPanel.Dock="Top">

            <fluent:RibbonTabItem Header="Xsd2Xml">

                <fluent:RibbonGroupBox Header="Generate">
                    <fluent:Button
                        Header="Generate Xml"
                        LargeIcon="/Images/arrow_start_32x32.png"
                        Click="btnGenerate_Click"
                    />
                </fluent:RibbonGroupBox>

                <fluent:RibbonGroupBox Header="Settings">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="360" />
                            <ColumnDefinition Width="100" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock
                            Grid.Row="0" Grid.Column="0"
                            VerticalAlignment="Center">
                            Name of the root element to begin generating the XML:
                        </TextBlock>
                        <ComboBox
                            x:Name="cboRoot" x:FieldModifier="private"
                            Grid.Row="0" Grid.Column="1"
                            IsEditable="True"
                        />
                        <TextBlock
                            Grid.Row="1" Grid.Column="0"
                            VerticalAlignment="Center">
                            Number of elements to be generated if maxOccurs='unbounded':
                        </TextBlock>
                        <TextBox
                            Grid.Row="1" Grid.Column="1"
                            x:Name="edtMaxThreshold" x:FieldModifier="private">2</TextBox>
                        <TextBlock
                            Grid.Row="2" Grid.Column="0"
                            VerticalAlignment="Center">
                            Number of items while generating a list type:
                        </TextBlock>
                        <TextBox Grid.Row="2" Grid.Column="1" x:Name="edtListLength" x:FieldModifier="private">2</TextBox>
                    </Grid>
                </fluent:RibbonGroupBox>

                <fluent:RibbonGroupBox Header="Result">
                    <fluent:Button
                        Header="Open in new window..."
                        SizeDefinition="Middle, Small"
                        Click="btnOpenInNewWindow_Click"
                    />
                    <fluent:Button
                        Header="Save As..."
                        Icon="/Images/SaveAsHH.png"
                        SizeDefinition="Middle, Small"
                        Click="btnSave_Click"
                    />
                    <fluent:CheckBox
                        x:Name="btnWordWrap" x:FieldModifier="private"
                        Header="WordWrap"
                        ToolTip="WordWrap"
                        SizeDefinition="Middle, Small"
                        IsChecked="True"
                    />
                </fluent:RibbonGroupBox>
                </fluent:RibbonTabItem>
            </fluent:Ribbon>

        <Border DockPanel.Dock="Top" Height="7" BorderBrush="Black" BorderThickness="0,1,0,0">
            <Border.Effect>
                <DropShadowEffect Direction="270" ShadowDepth="1" />
            </Border.Effect>
        </Border>

        <AvalonEdit:TextEditor x:Name="edtResult" IsReadOnly="True" FontFamily="Consolas"
                                FontSize="10pt" SyntaxHighlighting="XML" 
                                ShowLineNumbers="true" WordWrap="{Binding IsChecked, ElementName=btnWordWrap}"/>
    </DockPanel>
</Window>
